home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1992 April
/
1992-04.d64
/
damped vib.asc
< prev
next >
Wrap
Text File
|
2022-09-20
|
1KB
|
3 lines
100 rem -- damped vib --
105 print""
110 print"output to screen or printer (s/p) s";:inputa$
115 if a$="s" then z=1.33:z1=0:z2=26.4:goto130:rem values for screen output
120 if a$<>"p" then110
125 z=1.208:z1=2.01:z2=38.24:rem values for printer output
130 screen 1:hue0,1
135 wipe
140 rem -- set up constants --
145 rem -- xt and yt set x and y axes. xs and ys set start of x and y axes.
150 rem -- ex and ey are expansion factors for x and y coordinates.
155 xt=z2:yt=100:xs=z2:ys=0:ex=10*z:ey=1
160 rem -- calibrate x coordinates --
165 forx=xs to 319 step 5*z
170 y=yt:plotx,y:nextx
175 forx=xs to 319 step 10*z
180 fory=yt-1 to yt+1:plotx,y:nexty:nextx
185 forx=z2 to 319 step 50*z
190 fory=yt-2 to yt+2:plotx,y:nexty:nextx
195 rem -- calibrate y coordinates --
200 for y=ys to 199 step 5
205 x=xt:plotx,y:nexty
210 for y=ys to 199 step 10
215 for x=xt-1 to xt+1:plotx,y:nextx:nexty
220 for y=ys to 199 step 50
225 for x=xt-3 to xt+3:plotx,y:nextx:nexty
249 df=5:rem --- damping factor --
250 for x=.001 to 20 step .05
260 y=80*sin(3*x)*exp(-x/df)
270 x1=ex*x+z2:y1=ey*y+yt:plotx1,y1:nextx
999 rem -- screen or hardcopy --
1000 get a$:if a$="" then1000
1010 print "":screen 0:printchr$(14)
1020 print"hardcopy (y/n) n";:inputa$:ifa$="n" then1080
1030 ifa$<>"y"then1010
1040 print"single or double width (s/d) s";:inputa$
1050 ifa$="s" then poke2,1:goto1070
1060 poke2,2:ifa$<>"d"then1040
1070 screen 1:sys52224
1080 screen 0:printchr$(14):list
ready.